home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group02b.txt
/
000093_icon-group-sender_Mon Oct 28 07:59:56 2002.msg
< prev
next >
Wrap
Internet Message Format
|
2003-01-02
|
2KB
Return-Path: <icon-group-sender>
Received: (from root@localhost)
by baskerville.CS.Arizona.EDU (8.11.1/8.11.1) id g9SExrA05395
for icon-group-addresses; Mon, 28 Oct 2002 07:59:53 -0700 (MST)
Message-Id: <200210281459.g9SExrA05395@baskerville.CS.Arizona.EDU>
From: "Andrew Hamm" <ahamm@mail.com>
X-Newsgroups: comp.lang.icon
Subject: Re: Icon broken?
Date: Mon, 28 Oct 2002 10:46:50 +1100
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
To: icon-group@cs.arizona.edu
Errors-To: icon-group-errors@cs.arizona.edu
Status: RO
adeukcin wrote:
> I am trying to write a simple Regular Expression...
> s := "Ic(cond)best"
> re := RePat("( \(cond\) )")
>
> i := 0
> j := 0
>
> i := ReFind(re,s)
> j := ReMatch(re,s,i)
>
> s[i:j] := "on is the"
> write(s[i:j])
>
> From what I understand...
> This should output something like...
> "Icon is the best"
> instead it gives me somthing like...
> "Ic(on is the)best"
>
> the \( does not seem to remove the special meaning from (
>
RePat - hmm - I haven't seen them before. However....
your problem is understanding the need to use \ in strings. If you want a \
to be in a string, you need to back-slash it. The compiler reads the source
code and interprets it first.
re := RePat("( \\(cond\\) )")
now, the string stored internally in the object code and executed by the
runtime will contain the \ that you desire. Try writing the string to see
the difference with and without the correct number of \